package org.abacus.platform.workflow;

import java.util.HashSet;
import java.util.Set;

public class UnterwegsStation extends AbstractStation {

	private Set<UnterwegsStation> previous = new HashSet<UnterwegsStation>();

	private Set<UnterwegsStation> next = new HashSet<UnterwegsStation>();

	private AttachedAble attachedAble;

	private StartStation entrance;

	private EndStation exit;

	public StartStation getEntrance() {
		return entrance;
	}

	public void setEntrance(StartStation entrance) {
		this.entrance = entrance;
	}

	public EndStation getExit() {
		return exit;
	}

	public void setExit(EndStation exit) {
		this.exit = exit;
	}

	public Set<UnterwegsStation> getPrevious() {
		return previous;
	}

	public void setPrevious(Set<UnterwegsStation> previous) {
		this.previous = previous;
	}

	public Set<UnterwegsStation> getNext() {
		return next;
	}

	public void setNext(Set<UnterwegsStation> next) {
		this.next = next;
	}

	public AttachedAble getAttachedAble() {
		return attachedAble;
	}

	public void setAttachedAble(AttachedAble attachedAble) {
		this.attachedAble = attachedAble;
	}

	public WorkStationType getWorkStationType() {
		workStationType = WorkStationType.UNTERWEGS;
		return this.workStationType;
	}

	public AbstractStation goNext() {
		for (UnterwegsStation nex : getNext()) {
			if (nex.getAttachedAble().doWork()) {
				return nex;
			}
		}
		return null;
	}

	public AbstractStation goPrevious() {
		for (UnterwegsStation pre : getPrevious()) {
			if (pre.getAttachedAble().doWork()) {
				return pre;
			}
		}
		return null;
	}

}
